#include <iostream>
using std::cout;
using std::endl;

class A
{
public:
    virtual void print() = 0;
    virtual void display() = 0;
};

class B
: public A
{
public:
    virtual void print() override{
        cout << "B::print()" << endl;
    }

};

class C
: public B
{
public:
    virtual void display() override{
        cout << "C::display()" << endl;
    }
};

void test0(){
    //抽象类不能直接创建对象
    /* A a; */
    /* B b; */
    /* A * pa = &b; */
    C c;
    A* pa = &c;
    pa->print();
    pa->display();

    B* pb = &c;
    pb->print();
    pb->display();

    c.print();
    c.display();
}

int main(void){
    test0();
    return 0;
}
